#!/bin/sh

[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0

/etc/init.d/ipsec running || exit 0
uci show libreswan | grep -i "='$INTERFACE'$" || exit 0

logger -t libreswan "Restart libreswan due to $ACTION of $INTERFACE ($DEVICE)"

/etc/init.d/ipsec restart
